]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Use new `notification-removed` signal to cleanup notifications
authorJulian Sparber <julian@sparber.net>
Wed, 14 Feb 2024 18:24:01 +0000 (19:24 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 3 Mar 2024 01:33:16 +0000 (01:33 +0000)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>

js/ui/messageTray.js

index a861219a4b2038cf48411d35a72ae7331b4a5d86..d7d21f6664a59d4949944e55fc536ea1f4a69036 100644 (file)
@@ -925,6 +925,7 @@ export const MessageTray = GObject.registerClass({
 
         source.connectObject(
             'notification-show', this._onNotificationShow.bind(this),
+            'notification-removed', this._onNotificationRemoved.bind(this),
             'destroy', () => this._removeSource(source), this);
 
         this.emit('source-added', source);
@@ -952,7 +953,7 @@ export const MessageTray = GObject.registerClass({
         }
     }
 
-    _onNotificationDestroy(notification) {
+    _onNotificationRemoved(source, notification) {
         if (this._notification === notification) {
             this._notificationRemoved = true;
             if (this._notificationState === State.SHOWN ||
@@ -983,8 +984,6 @@ export const MessageTray = GObject.registerClass({
             let bannerCount = this._notification ? 1 : 0;
             let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
             if (!full || notification.urgency === Urgency.CRITICAL) {
-                notification.connect('destroy',
-                    this._onNotificationDestroy.bind(this));
                 this._notificationQueue.push(notification);
                 this._notificationQueue.sort(
                     (n1, n2) => n2.urgency - n1.urgency);